package com.robot.mvvm.ui.work.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.robot.base.model.QuestionDataDTOBean
import com.robot.mvvm.R

class RepairWorkOrderAdapter :
    BaseQuickAdapter<QuestionDataDTOBean, BaseViewHolder>(R.layout.app_item_repair_work_order) {
    override fun convert(holder: BaseViewHolder, item: QuestionDataDTOBean) {
        holder.setText(R.id.item_tv_title, item.equipmentName)
            .setText(
                R.id.item_tv_number,
                "${context.getString(R.string.app_tips_61)}:${item.equipmentNo}"
            )
            .setText(R.id.item_tv_name, item.questionTypeName)
            .setText(R.id.item_tv_content, item.questionDesc)
            .setText(R.id.item_tv_time, item.gmtCreateStr)
            .setText(R.id.item_tv_state, item.stateText)

        when (item.state) {
            //0-未处理，1-已派单，2-已驳回，3-进行中，4-已退回，5-已完成
            "0" -> {
                holder.setTextColor(R.id.item_tv_state, context.getColor(R.color.app_0A92FA))
            }
            "1" -> {
                holder.setTextColor(R.id.item_tv_state, context.getColor(R.color.app_FFB13D))
            }
            "2" -> {
                holder.setTextColor(R.id.item_tv_state, context.getColor(R.color.app_FF3D3D))
            }
            else -> {
                holder.setTextColor(R.id.item_tv_state, context.getColor(R.color.app_0A92FA))
            }
        }
    }
}